var api = domain()
var json = getQueryString()
try {
  appSetToken(json.apiToken)
} catch (error) {

}
new Vue({
  el: '#app',
  data() {
    return {
      des: '',
      id: json.id,
      list: '',
      rpList: [],
      tabList: [],
      user: '',
      img1: '../images/nan.png',
      img2: '../images/nv.png'
    }
  },
  created() {

    this.getData()
    this.getList()
  },
  methods: {
    getData() {
      var data = new FormData();
      data.append('product_id', this.id);
      data.append('order_no', json.order);
      const headers = {
        'authorization': getAppToken()
      }
      axios.post(api + '/v1/fortune/report', data, {
        headers
      })
        .then((res) => {
          if (res.data.code === 2000) {
            this.des = res.data.data.desc
            this.list = res.data.data.list
            this.user = res.data.data.user
            handleType(res.data.data.pro_type_sim)
            this.tabList = res.data.data.list
          } else {
            this.$toast({
              message: res.data.msg,
              position: 'middle',
              duration: 1000
            });
          }
        })
    },

    getList() {
      var data = new FormData();
      data.append('page', 1);
      data.append('pagesize', 10);
      data.append('pro_type', 30);
      const headers = {
        'authorization': getAppToken()
      }
      axios.post(api + '/v1/product/list', data, {
        headers
      })
        .then((res) => {
          this.rpList = res.data.data.list
        })
    },
    router(type, id) {
      window.location.href = '../html/index.html?id=' + id + '&apiToken=' + json.apiToken
    }
  }
});